import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class KochTurtle here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class KochTurtle  extends Turtle
{
    private int angle = 60;
    private int flakeSideCount = 3;
    public KochTurtle() {
        penDown();
    }
    
    public void kochCurve(int n, double length) {
        if ( n == 0 ) {
            move(length);
        } else {
            kochCurve(n-1, length/3); turn(-angle);
            kochCurve(n-1, length/3); turn(angle*2);
            kochCurve(n-1, length/3); turn(-angle);
            kochCurve(n-1, length/3);
        }
    }
    
    public void kochFlake(int n, double length) {
        for(int i = 0 ; i < flakeSideCount  ; i ++){
            kochCurve(n, length);
            turn(360/flakeSideCount);
        }
        
    }
    
    public void setAngle(int angle){
        this.angle = angle;
    }
    public void setFlakeSideCount(int count){
        if(count < 3)
            count = 3;
        flakeSideCount = count;
    }
}
